package cn.com.roy.thread.t4_1_10.lockmethodtest2;

import java.util.concurrent.locks.ReentrantLock;

public class MyService {
    public ReentrantLock lock = new ReentrantLock();
    public void serviceMehod1(){
        try {
            lock.lock();
            System.out.println("ThreadName=" + Thread.currentThread().getName() + "进入了方法");
            Thread.sleep(Integer.MAX_VALUE);
        } catch (Exception e){

        }finally {
            lock.unlock();
        }

    }


}
